<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/common/common_tag.jsp"%>
<%@include file="/common/common_js.jsp"%>
<script type="text/javascript">
	$(document).ready(function() {
		initEasyUIStyle();
		ClassRoomService.getClassRoomKeyMap(function(data) {
			addOption(data);
		})
	});
	addOption = function(data) {
		var optionName = $('#stuname');
		for ( var property in data) {
			var option ="<option value='"+property+"'>"+data[property]+"</option>";
			optionName.append(option);
		}
	}
	function btn_save() {
		var flag = $('#gradeForm').form('validate');
		if (flag) {
			$.ajax( {
				url : "grade_addGrade.do",
				type : "post",
				data : $("#gradeForm").serialize(),
				datatype : "json",
				success : function(data) {
					if (data.MSG == "success") {
						$.messager.alert('提示', '数据已保存!', 'info');
					} else {
						$.messager.alert('提示', '数据保存失败!', 'error');
					}
				}
			});
		}
	}
</script>
<div class="pageContent">
	<form id="gradeForm" method="post">
		<s:token />
		<div class="pageForm">
			<div class="pageFormContent">
				<div class="contentTitle">
					新增班级
				</div>
				<dl>
					<dt>
						班级名称：
					</dt>
					<dd>
						<input name="grade.name" type="text" class="required" />
					</dd>
				</dl>
				<dl>
					<dt>
						类型：
					</dt>
					<dd>
						<select class="combox required" name="grade.type" id="type">
							<option value="1" selected="selected">
								普通班级
							</option>
							<option value="2">
								兴趣班
							</option>
						</select>
					</dd>
				</dl>
				<dl>
					<dt>
						教室：
					</dt>
					<dd>
						<select class="combox required" name="grade.classRoom.id"
							id="stuname">
						</select>
					</dd>
				</dl>
			</div>
			<div class="formBar">
				<ul>
					<li>
						<a href="javascript:void(0)" class="easyui-linkbutton"
							iconCls="icon-save" id="btn_save" onclick=
	btn_save();
>提交</a>

					</li>
					<li>
						<a href="javascript:void(0)" class="easyui-linkbutton"
							iconCls="icon-cancel" id="btn_cancel">取消</a>
					</li>
				</ul>
			</div>
		</div>
	</form>

</div>
